<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%--
  Created by IntelliJ IDEA.
  User: 郑帅
  Date: 2019/8/17
  Time: 14:58
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<link rel="stylesheet" href="/layui/css/layui.css" media="all">
<script src="/js/jquery-1.9.1.min.js"></script>

<body>

<%--<div id="demo20"></div>--%> <%--<ul id="biuuu_city_list"></ul>--%>
<div class="demoTable">
    客户编号：
    <div class="layui-inline">
        <input class="layui-input" name="id" id="CustomerId" autocomplete="off" value="${param.CutId}" readonly="readonly">
    </div>
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp 客户名称：
    <div class="layui-inline">
        <input class="layui-input" name="id" id="CustomerName" autocomplete="off" value="${param.name}" readonly="readonly">
    </div>

    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp

</div>
<div style="width: 170px; margin-left: 1300px;margin-top: 5px">
    <button type="submit" class="layui-btn layui-btn-fluid" onclick="(location.href='/view/customer//LinkmanXJ.jsp?CutId='+${param.CutId})">
        <i class="layui-icon layui-icon-search">新建</i></button>
</div>
<table class="layui-hide" id="test" lay-filter="test" height=100></table>

<script src="<c:url value="/layui/layui.js"/>" charset="utf-8"></script>
<script src="<c:url value="/js/jquery-1.9.1.min.js"/>"></script>
<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-xs" lay-event="edit" target="_self" >编辑</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
    <script>
    $(function () {
        layui.use('table', function () {
            var table = layui.table;
            table.render({
                elem: '#test',
                url: '<c:url value="/Lank.do?CutId="/>'+${param.CutId},
                cellMinWidth: 95,
                page: true,
                height: "full-125",
                limits: [5, 10, 15, 20],
                limit: 5,
                id: "userListTable",

                height: "420px",
                response: {
                    statusName: 'code',// 对应 code
                    msgName: 'mag', // 对应 msg
                    countName: 'count', // 对应 count
                    dataName: 'data'  // 对应 data
                }
                ,

                cols: [[

                    // {field: 'stuid', title: 'ID', minWidth:100, align:"center"},
                    // {field: 'stuname', title: '姓名', align:'center'},
                    // {field: 'stuage', title: '年龄', align:'center',minWidth:150},
                    // {fixed: 'right', title:'操作', toolbar: '#barDemo', width:150}
                    {field: 'LanId', title: 'ID', minWidth: 100, align: "center",hide:true },
                    {field: 'Xm', title: '姓名', minWidth: 100, align: "center" },
                    {field: 'sex', title: '性别', align: 'center'},
                    {field: 'ZW', title: '职位', align: 'center', minWidth: 150},
                    {field: 'office_phone', title: '办工电话', minWidth: 100, align: "center"},
                    {field: 'mobile_phone', title: '手机', align: 'center'},
                    {field: 'remark', title: '备注', align:'center',minWidth:150},
                    {fixed: 'right', title:'操作', toolbar: '#barDemo', width:150}

                ]]

            });
            table.on('tool(test)', function (obj) {
                var data = obj.data;
                console.log(data.id)
                if (obj.event === 'del') {
                    layer.confirm('真的删除行么', function (index) {
                        obj.del();
                        deleteCon(data.LanId)
                        layer.close(index);
                    });
                } else if (obj.event === 'edit') {
                    customerLoss(obj.data.LanId);
                }
            });
        });
        function deleteCon(id)
        {
            $.get('<c:url value="/LinDelete.do"/>',{"id":id},function (da) {
                alert("刪除成功");
            })
        }
        function customerLoss(id)
        {

            location.href= '<c:url value="/LinLoad.do?id="/>'+id;

        }

    })
</script>



</body>
</html>
